package jm.nj.day07jia;
/*
* 学生类,属性私有化,提供setget
*
* 自我介绍方法
*
* 3.提供返回为String类型,参数为学生年龄,年龄比较方法
*
* 测试创建两个对象,进行对比
*
* 调用展示
*
* 对比
* */
public class Student {
    private String name;
    private int age;

    public Student(){

    }
    public Student(String name, int age){
        this.age = age;
        this.name = name;
    }

    //getset
    public String getName(){
        return name;
    }
    public void setName(String name){
         this.name = name;
    }

    public int getAge(){
        return age;
    }
    public void setAge(int age){
        this.age = age;
    }

    public void show(){
        System.out.println(name+":"+age);
    }

    public static   String compare(Student s, Student s1){

        if(s.getAge() > s1.getAge()){
            return s.getName();
        }else if(s.getAge() < s1.getAge()){
            return s1.getName();
        }else{
            return "一样大";
        }

    }
}
